package com.kedi.welfarecenter.service.operationcenter.impl;

import com.kedi.welfarecenter.read.dao.mapper.CommunityPenSecurityMapper;
import com.kedi.welfarecenter.service.operationcenter.CommunityPenSecurityService;
import com.kedi.welfarecenter.write.dao.mapper.WriteCommunityPenSecurityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
* @Description:    社区养老保障
* @Author:         ytw
* @CreateDate:     2019/7/23 16:02
* @UpdateRemark:   修改内容
* @Version:        1.0
*/
@Service
public class CommunityPenSecurityServiceImpl implements CommunityPenSecurityService {

    @Autowired
    CommunityPenSecurityMapper communityPenSecurityMapper;

    @Autowired
    WriteCommunityPenSecurityMapper wcommunityPenSecurityMapper;
    /**
    * 方法实现说明  查找所有
    * @author      ytw
    *@param
    * @return
    * @exception
    * @date        2019/7/26 9:28
    */
    @Override
    public List<Map<String, Object>> selectcps() {
        return communityPenSecurityMapper.selectcps();
    }
    /**
    * 方法实现说明  搜索框  根据机构名查找
    * @author      ytw
    *@param         welfaretitle
    * @return
    * @exception
    * @date        2019/7/26 9:28
    */
    @Override
    public List<Map<String, Object>> selectcpsByName(String welfaretitle) {
        return communityPenSecurityMapper.selectcpsByName(welfaretitle);
    }

    /**
    * 方法实现说明  根据福利表主键id 查找详情
    * @author      ytw
    *@param         welfareId
    * @return
    * @exception
    * @date        2019/7/26 9:29
    */
    @Override
    public List<Map<String, Object>> selectcpsDetails(Integer welfareId) {
        return communityPenSecurityMapper.selectcpsDetails(welfareId);
    }

    /**
    * 方法实现说明  发送电话
    * @author      ytw
    *@param         welfarereceiverid
    * @return
    * @exception
    * @date        2019/7/26 9:29
    */
    @Override
    public Map<String, Object> selectcpsPhone(Integer welfarereceiverid) {
        return communityPenSecurityMapper.selectcpsPhone(welfarereceiverid);
    }

    /**
    * 方法实现说明  新增社区养老保障
    * @author      ytw
    *@param     welfaretitle,lowage,heighage,name,price,givetime
    * @return
    * @exception
    * @date        2019/7/26 9:30
    */
    @Transactional(rollbackFor=Exception.class)
    @Override
    public Integer createcps(String welfaretitle, Integer lowage, Integer heighage, String name, Integer price, String givetime) {
        return wcommunityPenSecurityMapper.createcps(welfaretitle,lowage,heighage,name,price,givetime);
    }

    /**
    * 方法实现说明  修改社区养老保障
    * @author      ytw
    *@param         welfaretitle,lowage,heighage,name,price,givetime,welfareid
    * @return
    * @exception
    * @date        2019/7/26 9:30
    */
    @Transactional(rollbackFor=Exception.class)
    @Override
    public Integer updatecps(String welfaretitle, Integer lowage, Integer heighage, String name, Integer price, String givetime, Integer welfareid) {
        return wcommunityPenSecurityMapper.updatecps(welfaretitle,lowage,heighage,name,price,givetime,welfareid);
    }

    /**
    * 方法实现说明  新增领取人等信息
    * @author      ytw
    *@param
    * @return
    * @exception
    * @date        2019/7/26 9:31
    */
    @Transactional(rollbackFor=Exception.class)
    @Override
    public Integer createwelfarereceiver(Integer welfareid, String welfarereceiver, String idcard, String receivtime, String phone,Integer status) {
        return wcommunityPenSecurityMapper.createwelfarereceiver(welfareid,welfarereceiver,idcard,receivtime,phone);
    }
}
